﻿using System;

namespace ProblemsSet
{
    public class Problem_63 : BaseProblem
    {
        public override object GetResult()
        {
            var res = 0;
            for (long k = 1; k < 10; k++ )
            {
                for (long n = 1; n < 2/(1-Math.Log10(k)); n++)
                {
                    if ((long)Math.Log10(Math.Pow(k,n)) == n-1)
                        res++;
                }
            }
            return res;
        }

        public override string Problem
        {
            get
            {
                return @"The 5-digit number, 16807=75, is also a fifth power. Similarly, the 9-digit number, 134217728=89, is a ninth power.

How many n-digit positive integers exist which are also an nth power?";
            }
        }

        public override bool IsSolved
        {
            get
            {
                return true;
            }
        }

        public override object Answer
        {
            get
            {
                return 49;
            }
        }
    }
}
